import { request } from '../utils/request'

// 根据用户名查询问答  kind：普通用户：questioner；专家：expert
export function selectQuestionByUser(params) {
    return request({
        method: 'get',
        url: `/question/selectByKind/${params.type}`,
        headers: {
            'Authorization': window.localStorage.token,
        },
        // data:params
    })
}

// 根据id修改
export function reviseQuestionByUserId(params) {
    return request({
        method: 'put',
        url: '/question/update',
        headers: {
            'Authorization': window.localStorage.token,
        },
        data:params
    })
}

// 根据id删除
export function delQuestionByUserId(params) {
    return request({
        method: 'delete',
        url: `/question/delete/${params.id}`,
        headers: {
            'Authorization': window.localStorage.token,
        },
        data:params
    })
}

// 根据用户名查询预约  kind：普通用户：questioner；专家：expert
export function selectAppointByUser(params) {
    return request({
        method: 'get',
        url: `/reserve/selectByKind/${params.type}`,
        headers: {
            'Authorization': window.localStorage.token,
        },
        // data:params
    })
}

// 根据id修改预约
export function reviseAppointByUserId(params) {
    return request({
        method: 'put',
        url: '/reserve/update',
        headers: {
            'Authorization': window.localStorage.token,
        },
        data:params
    })
}

// 根据id删除预约
export function delAppointByUserId(params) {
    return request({
        method: 'delete',
        url: `/reserve/delete/${params.id}`,
        headers: {
            'Authorization': window.localStorage.token,
        },
        data:params
    })
}

//4根据id修改知识
export function updateKnowledgeById(params) {
    return request({
        method: 'put',
        url: 'knowledge/' + params.knowledgeId,
        data: params,
        headers: {
            'Authorization': window.localStorage.token,
        },
    })
}

// 3根据id删除知识
export function deleteKnowledgeById(params) {
    return request({
        method: 'delete',
        url: 'knowledge/' + params.knowledgeId,
        params: params,
        headers: {
            'Authorization': window.localStorage.token,
        },
    })
}

// 1根据id查询知识信息
export function selectKnowledgeById(params) {
    return request({
        method: 'get',
        url: 'knowledge/selectById/' + params.knowledgeId,
        headers: {
            'Authorization': window.localStorage.token,
        },
    })
}

// 2根据登录用户查询知识
export function selectKnowledgeByUsername(params) {
    return request({
        method: 'get',
        url: 'knowledge/selectByUsername/',
        headers: {
            'Authorization': window.localStorage.token,
        },
    })
}
// 添加知识
export function addKnowledge(params) {
    return request({
        method: 'post',
        url: 'knowledge',
        data: params,
        headers: {
            'Authorization': window.localStorage.token,
        },
    })
}